<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      //返回true or false 判断电话号码
      function isPhoneNumber(text) {
        const regex = /^[1][3,4,5,7,8][0-9]{9}$/;
        return regex.test(text);
      }
      // 判断两个字符串是否匹配
      function isMatch(str, pattern) {
        const regex = new RegExp(pattern);
        return regex.test(str);
      }
      const pattern = "asd";
      let value1 = isMatch("asd,gfdgerg", pattern);
      let value2 = isMatch("0", pattern);
      console.log("v1", value1);
      console.log("v2", value1);
    </script>
  </body>
</html>
